package com.csw.mysqldate.controller;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class ISNumberOrISCharacter {

	public static void main(String[] args) {
		String ss1 = "35879076543";
		String ss2 = "fsgjnbvgrethjnb";
		String ss3 = "5tfvgy7uhju89yugfde4f";
		log.info("" + "isNumber/////////////////////////");
		log.info("" + isNumber(ss1));
		log.info("" + isNumber(ss2));
		log.info("" + isNumber(ss3));
		log.info("" + "isCharacter//////////////////////////");
		log.info("" + isCharacter(ss1));
		log.info("" + isCharacter(ss2));
		log.info("" + isCharacter(ss3));

	}

	public static boolean isNumber(String str) {
		for (int i = 0; i < str.length(); i++) {
			if (!(str.charAt(i) >= '0' && str.charAt(i) <= '9')) {
				return false;
			}
		}
		return true;
	}

	public static boolean isCharacter(String str) {
		for (int i = 0; i < str.length(); i++) {
			if (!((str.charAt(i) >= 'a' && str.charAt(i) <= 'z') || (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z'))) {
				return false;
			}
		}
		return true;
	}
}
